package com.daohang361.imqq.protocol;

import java.nio.charset.Charset;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;


public class HexBytesProtocolfactory implements ProtocolCodecFactory {
	private  ProtocolEncoder  encoder; 
	private  ProtocolDecoder  decoder; 
	
	public HexBytesProtocolfactory() {
		this(Charset.defaultCharset()); 
	}
	public HexBytesProtocolfactory(Charset defaultCharset) {
		this.encoder = new HexEncodeProtocol(defaultCharset); 
		this.decoder = new HexDecodeProtocol(defaultCharset); 

	}
	@Override
	public ProtocolDecoder getDecoder(IoSession arg0) throws Exception {
		return decoder;
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession arg0) throws Exception {
		return encoder; 

	}

}
